﻿Public Class DIEM
    Public x As Double
    Public y As Double
    Public Sub New()
        x = 0
        y = 0
    End Sub
    Public Sub New(ByVal x As Double, ByVal y As Double)
        Me.x = x
        Me.y = y
    End Sub
    Public Sub nhap(ByRef D As DIEM)
        Console.WriteLine("nhap vao toa do cua diem x:")
        D.x = Double.Parse(Console.ReadLine())
        Console.WriteLine("nhap vao toa do cua diem y:")
        D.y = Double.Parse(Console.ReadLine())
    End Sub
    Public Sub xuat(ByVal D As DIEM)
        Console.WriteLine(" toa do cua diem  la ({0},{1})", D.x, D.y)
    End Sub
    Public Sub xuatx(ByVal D As DIEM)
        Console.WriteLine("thong tin cua diem x la:({0})", D.x)
    End Sub
    Public Sub xuaty(ByVal D As DIEM)
        Console.WriteLine("thong tin cua diem y la:({0})", D.y)
    End Sub
    Public Sub nhapx(ByRef D As DIEM)
        Console.WriteLine("nhap vao toa do cua diem x:")
        D.x = Double.Parse(Console.ReadLine())
    End Sub
    Public Sub nhapy(ByRef D As DIEM)
        Console.WriteLine("nhap vao toa do cua diem y:")
        D.y = Double.Parse(Console.ReadLine())
    End Sub
    Public Sub TINHTRUCX(ByRef A As DIEM, ByRef B As DIEM)
        Console.WriteLine("{0}", Math.Abs(B.x - A.x))
    End Sub
    Public Sub TINHTRUCY(ByRef A As DIEM, ByRef B As DIEM)
        Console.WriteLine("{0}", Math.Abs(B.y - A.y))
    End Sub
    Public Sub TINHKC2DIEM(ByRef A As DIEM, ByRef B As DIEM)
        Console.WriteLine("{0}", Math.Sqrt((B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y)))
    End Sub
End Class


